<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>编辑用户</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/resource/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/resource/css/mylay.css">
</head>
<body>
    <div style="padding: 20px; background-color: #F2F2F2;">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <form class="layui-form" action="">
                            <table class="layui-table" lay-even lay-skin="nob">
                                <thead></thead>
                                <tbody>
                                <tr>
                                    <td>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">邮件</label>
                                            <div class="layui-input-block">
                                                <textarea name='mail_content' placeholder="" class="layui-textarea">{$userInfo.mail_content}</textarea>
                                            </div>
                                            <div class="layui-form-mid layui-word-aux"></div>
                                        </div>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                            <div class="layui-form-item" style="margin-top: 40px;text-align: center;">
                                <input type="hidden" name="id" value="{$userInfo.id}" autocomplete="off" class="layui-input">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit lay-filter="usermail">立即提交</button>
                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

<script src="/resource/layuiadmin/layui/layui.js"></script>
<script src="/resource/js/manage/init_date.js"></script>
<!--<script src="/resource/js/manage/user.js"></script>-->
<script>
    layui.use(['table'], function() {
        var $ = layui.$
            ,form = layui.form
            , table = layui.table;

        form.on('submit(usermail)', function(data){
            $.ajax({
                url: "/manage/user/mail",
                data: data.field,
                type: "POST",
                dataType: "json",
                timeout: 15000,
                beforeSend: function(){
                    layer.load(1);
                },
                success: function(msg){
                    var alertStr = (msg == 1) ? '操作成功' : msg;
                    layer.msg(alertStr, {time: 2000}, function(){
                        if(msg==1){
                            parent.layer.closeAll();
                            parent.layui.table.reload('userList');
                        }
                    });
                },
                complete: function(){
                    layer.closeAll("loading");
                }
            });
            return false;
        });
    })
</script>
</body>
</html>
